package top.laoliu.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.laoliu.mapper.ResumeMapper;
import top.laoliu.pojo.ResumeVo;
import top.laoliu.service.ResumeService;

/**
 * @Author: acer
 * @Date: 2020/10/18 16:36
 * @Description:
 */
@Service
public class ResumeServiceImpl implements ResumeService {
    @Autowired
    ResumeMapper resumeMapper;

    @Override
    public ResumeVo getResumeVoByUserId(Integer user_id) {
        return resumeMapper.getResumeVoByUserId(user_id);
    }

    @Override
    public boolean insertResume(ResumeVo resumeVo) {
        int a = resumeMapper.insertResume(resumeVo);
        int b = resumeMapper.insertEducationExperience(resumeVo);
        int c = resumeMapper.insertMajorSkill(resumeVo);
        int d = resumeMapper.insertPracticalExperience(resumeVo);
        int e = resumeMapper.insertProject(resumeVo);
        if (a>0&&b>0&&c>0&&d>0&&e>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateResume(ResumeVo resumeVo) {
        int a = resumeMapper.updateResume(resumeVo);
        int b = resumeMapper.updateEducationExperience(resumeVo);
        int c = resumeMapper.updateMajorSkill(resumeVo);
        int d = resumeMapper.updatePracticalExperience(resumeVo);
        int e = resumeMapper.updateProject(resumeVo);
        if (a>0&&b>0&&c>0&&d>0&&e>0){
            return true;
        }
        return false;
    }
}
